﻿using Game;
using System;
using System.Globalization;

namespace SAGhoul.Blocks
{
    public class ClothesWornModLoader : ModLoader
    {
        public override void __ModInitialize()
        {
            ModsManager.RegisterHook("DecodeIngredient", this);
        }

        public override void DecodeIngredient(string ingredient, out string craftingId, out int? data, out bool Decoded)
        {
            data = 0;
            Decoded = false;
            string[] array = ingredient.Split([':'], StringSplitOptions.None);
            craftingId = array[0];
            if (craftingId == BlocksManager.Blocks[203].CraftingId)
            {
                Decoded = true;
                data = array.Length >= 2 ? new int?(int.Parse(array[1], CultureInfo.InvariantCulture)) : null;
                data &= 0xFF;
            }
        }
    }
}
